import http from "@/utils/http";

const BPMService = {
    /**
     * bpm流程图
     * @param {}} condition 
     * @returns 
     */
	async getBpmXml(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/taskQuery/getBpmXml`,
			params: condition,
			method: "GET",
		});
		return res;
	},
    async activityInstance(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/engine-rest/history/activity-instance`,
			params: condition,
			method: "GET",
		});
		return res;
	},
	async getBpmInfo(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/taskQuery/getBpmInfo`,
			params: condition,
			method: "GET",
		});
		return res;
	},

  /**
   * 流程维护:启动流程
   * @param {*} condition 
   * @returns 
   */
  async startBpmProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/startBpmProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
  /**
   * 流程维护:完成销售品级别任务
   * @param {*} condition 
   * @returns 
   */
  async finishOneTaskProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/finishOneTaskProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
  /**
   * 流程维护:完成项目级别任务
   * @param {*} condition 
   * @returns 
   */ 
  async finishManyTaskProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/finishManyTaskProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
  /**
   * 流程维护:最高权限完成任务
   * @param {*} condition 
   * @returns 
   */
  async godFinishTaskProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/godFinishTaskProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
  /**
   * 流程维护:连线开始
   * @param {*} condition 
   * @returns 
   */
  async startTransitionProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/startTransitionProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
  /**
   * 流程维护:完成某一个任务之后的派发
   * @param {*} condition 
   * @returns 
   */
  async startAfterActivityProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/startAfterActivityProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
  /**
   * 流程维护:派发任务
   * @param {*} condition 
   * @returns 
   */
  async assignedTaskProcess(condition) {
		let res = await http({
			url: `${process.env.VUE_APP_CTX_BPM_QUERY}/mainPage/assignedTaskProcess`,
			params: condition,
			method: "GET",
		});
		return res;
	},
};
export default BPMService;